/*
 * JOGRE (Java Online Gaming Real-time Engine) - API
 * Copyright (C) 2005  Bob Marks (marksie531@yahoo.com)
 * http://jogre.sourceforge.org
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */
package org.jogre.client.awt;

import java.awt.Dimension;
import java.awt.Font;
import java.awt.Point;
import java.awt.Window;

/**
 * Convience class which holds a number of static constants such as fonts etc.
 *
 * @author Bob Marks
 * @version Beta 0.3
 */
public class JogreAwt {

	/**
	 * Font used in the user list, table list and player list boxes.
	 */
	public static final Font LIST_FONT = new Font ("Dialog", Font.PLAIN, 12); 
	
	/**
	 * Bold font used in the user list, table list and player list boxes.
	 */
	public static final Font LIST_FONT_BOLD = new Font ("Dialog", Font.BOLD, 13);
	
	/**
	 * Return the minimum size.
	 * 
	 * @param window   Window e.g. frame that component is called from.
	 * @return         Dimension of size.
	 */
	public static Dimension getMinimumSize (Window window, int defaultWidth, int defaultHeight) {		
		Dimension minSize = window.getMinimumSize();
		Dimension size = new Dimension(
				Math.max((int)minSize.getWidth(),  defaultWidth),
				Math.max((int)minSize.getHeight(), defaultHeight));
		
		return size;
	}
	
	/**
	 * Return the location of a centred component on screen.
	 * 
	 * @param window       Window e.g. frame that component is called from.
	 * @param screenSize   Screen size.
	 * @return             Dimenion contain location.
	 */
	public static Point getCentredLocation (Window window, Dimension componentSize) {
		Dimension screenSize = window.getToolkit().getScreenSize();
		Point p = new Point (
			(int)(screenSize.getWidth() / 2 - componentSize.getWidth() / 2), 
			(int)(screenSize.getHeight() / 2 - componentSize.getHeight() / 2));
		
		return p;
	}
}